const Router = require('koa-router')
const router = new Router()
router.prefix('/api/home/text')

const { //控制器
    checkTextExist, findList, create,
    update, findById, delete: del
} = require('../controllers/homeText')

const { //中间件
    auth, checkUserAuthorization
} = require('../middleware/index')

router.get('/', findList) //获取文字列表

router.get('/:id', checkTextExist, findById) //获取指定文字详情

router.post('/', auth, checkUserAuthorization, create) //新建文字

router.patch('/:id', auth, checkUserAuthorization, checkTextExist, update) //更新文字

router.delete('/:id', auth, checkUserAuthorization, checkTextExist, del) //删除文字

module.exports = router
